alert(aString) | Displays an Alert box with the message and an OK button, e.g., alert("Cancelled by User Request"). Used to alert users of important conditions. |
confirm(aString) | Displays a Confirm dialog box with the message and both OK and CANCEL buttons, e.g., confirm("Really Leave?"). Used to prompt user for a decision. |
prompt(message, default) |
Displays a Prompt dialog box with the message, a text
entry input and both OK and CANCEL buttons, e.g.,
ans=prompt("Message", "TheDefaultResponse"); if (!ans) alert("You pressed cancel.") else if alert("You said "+ans) . |
defaultStatus | Change the default value of the status bar text, e.g., window.defaultStatus="Pick an option". |
status | Change the immediate value of the status bar text, e.g., window.status="This link leads to more information". This value will disappear at the next onMouseOver event, usually the time that the mouse next moves. |
For example,
document.open()
document.write('<H1>Hello World!</H1>')
document.close()
Document Creation | |
open() | Reset the document and prepare to write, e.g., document.open(). |
close() | Finish writing to the document and display it, e.g., document.close(). |
Writing | |
write(aString) | Adds the string to the new document. The string can include HTML directives, e.g., document.write('<H1>Hello World!</H1>'). Used to build the contents of a window. |
writeln(aString) | Same as write, but carriage return appended at the end. Useful for preformatted text (<PRE>), e.g., document.writeln('<H1>Hello World!</H1>'). |
Formats | |
big() | Create a string which uses a big font, e.g., document.write('Hello World'.big()) is the same as document.write('<BIG>Hello World</BIG>'). |
blink() | Create a blinking string, e.g., document.write('Hello World'.blink()) is the same as document.write('<BLINK>Hello World</BLINK>'). |
bold() | Create a string with a bold font, e.g., document.write('Hello World'.bold()) is the same as document.write('<B>Hello World</B>'). |
fixed() | Create a string with a fixed (non-proportional) font, e.g., document.write('Hello World'.fixed()) is the same as document.write('<TT>Hello World</TT>'). |
fontcolor(aColor) | Create a string with a particular color, e.g., document.write('Hello World'.fontcolor(aColor)) is the same as document.write('<FONT COLOR=aColor>Hello World</FONT>'). |
fontsize(aSize) | Create a string with a particular fontsize, e.g., document.write('Hello World'.fontsize(aSize)) is the same as document.write('<FONT SIZE=aSize>Hello World</FONT>'). |
italics() | Create a string which uses an italicized font, e.g., document.write('Hello World'.italics()) is the same as document.write('<I>Hello World</I>'). |
small() | Create a string which uses a small font, e.g., document.write('Hello World'.small()) is the same as document.write('<SMALL>Hello World</SMALL>'). |
strike() | Create a string with struck-out text, e.g., document.write('Hello World'.strike()) is the same as document.write('<STRIKE>Hello World</STRIKE>'). |
sub() | Create a string which displays as a subscript, e.g., document.write('Hello World'.sub()) is the same as document.write('<SUB>Hello World</SUB>'). |
sup() | Create a string which displays as a superscript, e.g., document.write('Hello World'.sup()) is the same as document.write('<SUP>Hello World</SUP>'). |
Anchors and links | |
anchor(aName) | Create an anchor, e.g., document.write('Hello World'.anchor(aName)) is the same as document.write('<A NAME="aName">Hello World</A>'). |
link(anHref) | Create a link, e.g., document.write('Hello World'.link(anHref)) is the same as document.write('<A HREF="anHref">Hello World</A>'). |